﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _94求最大值的两个重载方法
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            int[] array = { 2, 1, 2, 6, 3 };
            Console.WriteLine(Max(array));

            float[] array1 = { 2.1f, 3.2f, 1.0f };
            Console.WriteLine(Max(array1));
        }

        private static int Max(int[] array)
        {
            int max = array[0];
            for (int i = 1; i < array.Length; i++)
            {
                if (array[i] > max)
                {
                    max = array[i];
                }
            }
            return max;
        }

        private static float Max(float[] array)
        {
            float max = array[0];
            for (int i = 1; i < array.Length; i++)
            {
                if (array[i] > max)
                {
                    max = array[i];
                }
            }
            return max;
        }
    }
}